<?php /*a:2:{s:58:"/www/wwwroot/car/application/admin/view/liberum/index.html";i:1586350404;s:56:"/www/wwwroot/car/application/admin/view/common/foot.html";i:1575009678;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title><?php echo config('sys_name'); ?>后台管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="/static/plugins/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="/static/admin/css/global.css" media="all">
    <link rel="stylesheet" href="/static/common/css/font.css" media="all">
    <link href="//netdna.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
    <style>

        .filtrate-warp{
            margin-bottom: 10px;
        }

        .filtrate-warp .title{
            padding: 5px 12px 7px 12px;
            font-size: 14px;
            font-weight: normal;
            text-align: left;
            cursor: pointer;
            width: 90px;
            background-color: transparent!important;
            color: black!important;
        }

        .filtrate-warp .title:hover{
            color: black;
        }

        .filtrate-warp .flag{
            padding: 6px 12px 6px 12px;
            cursor: pointer;
        }

        .filtrate-warp .flag:hover{
            color: black;
        }

        .filtrate-warp .layui-badge:hover{
            color: white!important;
        }

    </style>

</head>
<body class="skin-<?php if(!empty($_COOKIE['skin'])){echo $_COOKIE['skin'];}else{echo '0';setcookie('skin','0');}?>">

<div class="admin-main layui-anim layui-anim-upbit">



    <fieldset class="layui-elem-field " >
        <legend>高级查询</legend>

        <div class="layui-card" style="box-shadow: none;margin-top: 10px">
            <div class="layui-form layui-card-header layuiadmin-card-header-auto" style="border-bottom: transparent;height: auto" >

                <div class="layui-form-item" style="text-align: left;padding-left: 20px;">

                    <div class="layui-inline">
                        <label class="layui-form-label">日期查询：</label>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" autocomplete="off" name="at_time" id="at_time" placeholder="请输入日期查询">
                        </div>

                    </div>

                    <div class="layui-inline">
                        <label class="layui-form-label" style="margin-left: 5px">公海类型：</label>
                        <div class="layui-input-inline">
                            <select name="pr_gh_type" id="pr_gh_type">
                                <option value="">请选择公海类型</option>

                                <?php if(is_array($ghTypeList) || $ghTypeList instanceof \think\Collection || $ghTypeList instanceof \think\Paginator): $i = 0; $__LIST__ = $ghTypeList;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
                                <option value="<?php echo htmlentities($vo['type_name']); ?>"><?php echo htmlentities($vo['type_name']); ?></option>
                                <?php endforeach; endif; else: echo "" ;endif; ?>

                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">手机：</label>
                        <div class="layui-input-inline">
                            <input type="text" id="phone" name="phone" placeholder="请输入手机号码" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label" style="">客户名称：</label>
                        <div class="layui-input-inline">
                            <input type="text" id="kh_name" name="kh_name" placeholder="请输入客户名称" class="layui-input">
                        </div>
                    </div>
                    <!-- <div class="layui-inline">
                        <label class="layui-form-label" style="">时间查询：</label>
                        <div class="layui-input-inline">
                            <select name="timebucket">
                                <option value="">请选择时间</option>
                                <option value="today">今天</option>
                                <option value="yesterday">昨天</option>
                                <option value="week">本周</option>
                                <option value="last week">上周</option>
                                <option value="month">本月</option>
                                <option value="last month">上月</option>
                                <option value="year">今年</option>
                                <option value="last year">去年</option>
                                <option value="-2 hours">两个小时内</option>
                            </select>
                        </div>
                    </div> -->


                </div>



                <div class="layui-inline" style="float: right;padding-bottom: 15px">
                    <button class="layui-btn layuiadmin-btn-list"  lay-submit lay-filter="LAY-app-contlist-search">
                        <i class="layui-icon layui-icon-search layuiadmin-button-btn"  style="vertical-align: sub;"></i>查询数据
                    </button>
                </div>

            </div>
        </div>



    </fieldset>






    <table class="layui-table" id="table-list" lay-filter="table-list"></table>
</div>



<script type="text/html" id="action">
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="robClient" style="font-size: 14px"><i class="fa fa-user-o"></i>  抢</a>
</script>


<!--<script type="text/html" id="topBtn">
    <button type="button" class="layui-btn layui-btn-warm layui-btn-sm" id="robAllClient" style="font-size: 14px"><i class="fa fa-user-o"></i>  抢</button>
</script>-->


<script type="text/javascript" src="/static/plugins/layui/layui.js"></script>


<script>
    layui.use(['table','form','upload','util','laydate'], function() {
        var table = layui.table,form = layui.form,laydate = layui.laydate, $ = layui.jquery,upload = layui.upload,util = layui.util;
        var tableIn = table.render({
            elem: '#table-list',
            url: '<?php echo url("index"); ?>',
            method: 'post',
            toolbar: '#topBtn',
            page: true,
            cols: [[
                {checkbox:true,fixed: true},
                {field: 'id', title: 'ID', width: 80, fixed: true,hide:true},
                {field: 'kh_name', title: '客户名称',templet:function (res) {
                        return "<a href='<?php echo url('libdialog'); ?>?id="+res.id+"'>"+res.kh_name+"</a>";
                    }},
                {field: 'kh_rank', title: '客户级别', },
                {field: 'last_up_records', title: '最新跟进记录', },
                {field: 'last_up_time', title: '实际跟进时间',templet:function (res) {
                        return res.last_up_time ? util.toDateString(res.at_time = (res.at_time * 1000)) : '暂无跟进时间';
                    }},
                {field: 'remark', title: '备注', },
                {field: 'at_time', title: '创建时间',templet:function (res) {
                        return util.toDateString(res.at_time = (res.at_time * 1000));
                    }},
                {field: 'to_gh_time', title: '最新转入时间',templet:function (res) {
                        return util.toDateString(res.to_gh_time = (res.to_gh_time * 1000));
                    }},
                {field: 'pr_user_bef', title: '前负责人', },
                {title:'操作',width: 160, align: 'center', toolbar: '#action'}
            ]],
            limit: 10 //每页默认显示的数量
        });


        table.on('tool(table-list)', function(obj) {
            var data = obj.data;

            if (obj.event === 'robClient') {
                layer.confirm('您确定要抢这个客户吗？', function(index){
                    var loading = layer.load(1, {shade: [0.1, '#fff']});
                    $.post("<?php echo url('robClient'); ?>",{id:data.id},function(res){
                        layer.close(loading);
                        if(res.code===0){
                            layer.msg(res.msg,{time:1000,icon:1});
                            tableIn.reload();
                        }else{
                            layer.msg('操作失败！',{time:1000,icon:2});
                        }
                    });
                    layer.close(index);
                });
            }
        });


        //监听搜索
        form.on('submit(LAY-app-contlist-search)', function(data){
            var field = data.field;

            /* layer.alert(JSON.stringify(data.field), {
                  title: '最终的提交信息'
                })
                return false;*/


            table.reload('table-list', {
                url:"<?php echo url('Liberum/liberumSearch'); ?>",
                where: {
                    keyword: data.field
                },
                page:{
                    curr:1
                }
            });


        });

        laydate.render({
            elem: '#at_time'
        });


    });
</script>


<script>


</script>
</body>
</html>